package com.ebupt.migu.music;

import com.ebupt.migu.music.utils.SFTPUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.File;

/**
 * @description: TODO
 * @author: liuyangyang@ebupt.com
 * @date: 2021/5/24 14:13
 */
@Slf4j
@RestController
@RequestMapping("/sftp/test")
public class SFTPTest {

    @Autowired
    private SFTPUtils sftpUtils;

    @RequestMapping(value = "/upload", method = RequestMethod.GET)
    public void deptModify() throws Exception {
        String path = "/home/music/apps/temp/a_10008_80010_20210522_DX20210521153921.dat";
        File file = new File(path);
        log.info("文件名：{}", file.getName());
        sftpUtils.uploadFile(file.getName(), file);
        log.info("finished");
    }
}
